// implemented in mj6000

    /********************************************************/
    /*                                                      */
    /*                                                      */
    /*         Copyright (C), 1993  SEIKO EPSON Corp.       */
    /*         ALL RIGHTS RESERVED                          */
    /*                                                      */
    /*                                                      */
    /*  file name : realloc.c                               */
    /*                                                      */
    /*  Revision history                                    */
    /*      93/12/17    first release       S.Akaiwa        */
    /*      97/02/20    modified            T.Katahira      */
    /*                  change function declaration         */
    /*                          to the ANSI style           */
    /*      00/06/02    modified            M.Kakinuma      */
    /*      00/11/14    Ver2.10             M.Kakinuma      */
    /*                                                      */
    /********************************************************/

#ifdef      UNIX
#include    "stdlib.h"
#include    "string.h"
#include    "errno.h"
#include    "smcvals.h"
#else
#include    <stdlib.h>
#include    <string.h>
#include    <errno.h>
#include    <smcvals.h>
#endif

/* prototype */
void * realloc(void *, size_t);

    /********************************************************/
    /*                                                      */
    /*  The realloc function changes the size of allocated  */
    /*  memory block to the specify size.                   */
    /*  If realloc function can not be re-allocated memory  */
    /*  block, NULL pointer is returned.                    */
    /*  If successful, this function returns top address to */
    /*  re-allocated memory block.                          */
    /*  The realloc function does following operation       */
    /*  according to the value of specified by vpModPtr and */
    /*  tdSiz.                                              */
    /*                                                      */
    /*  vpModPtr == NULL , tdSiz == 0   -> error            */
    /*  vpModPtr != NULL , tdSiz == 0   -> free(vpModPtrP); */
    /*  vpModPtr == NULL , tdSiz != 0   -> malloc(tdSiz);   */
    /*  vpModPtr != NULL , tdSiz != 0   -> re-allocate      */
    /*                                                      */
    /*  The memory block is allocated from 4 byte boundary  */
    /*  address.                                            */
    /*  If you need the information of malloc memory map,   */
    /*  please refer to malloc source file.                 */
    /*                                                      */
    /*      RETURN  NULL    ... Memory allocate error       */
    /*              Others  ... Top address to re-allocated */
    /*                          memory block                */
    /*                                                      */
    /********************************************************/

    /* void    *   vpModPtrP   ;        re-allocate address */
    /* size_t      tdSiz       ;           re-allocate size */

void *
realloc(void * vpModPtrP, size_t tdSiz)
{
	void * ptr = malloc(tdSiz);
	if (NULL == ptr) {
		return NULL;
	}

	memcpy(ptr, vpModPtrP, tdSiz);
	return ptr;
}

